Skip to content

Send the intent source in a single track visit - #847

Merged
enotniy merged 1 commit into
developfrom
feature/fix-track-visit-source-for-reinit
Nov 20, 2026
Merged

enotniy merged 1 commit into
developfrom
feature/fix-track-visit-source-for-reinit

Conversation

@enotniy

@enotniy enotniy commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Проблема

После запуска приложения по пушу или ссылке следующие track visit по тому же intent повторяли его источник: повторный Mindbox.init и возврат из фона отправляли push или link с тем же URL вместо direct. Флаг intentChanged выставлялся при получении intent и не сбрасывался после отправки визита.

Решение

Флаг сбрасывается в момент чтения источника (takeIntentSource), поэтому источник intent попадает ровно в один визит. Все следующие визиты уходят как direct, пока не придёт новый intent. Флаг стал AtomicBoolean, чтобы чтение и сброс были одной операцией.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Deferred visits consume launch attribution before callbacks are available, and background cancellation discards it, so the first delivered visit can incorrectly be reported as DIRECT instead of retaining push or link attribution.

1 open issue
What changed in this PR

This PR updates the SDK’s visit tracking so a push or link intent supplies attribution to one visit, while subsequent visits use DIRECT until a new intent arrives.

Changes:

  • Replace the intent-change flag with an AtomicBoolean and consume it when reading the visit source.
  • Add regression tests for reinitialization and foreground transitions after push/link launches.
File Description
sdk/​src/​test/​java/​cloud/​mindbox/​mobile_sdk/​managers/​LifecycleManagerTest.kt Tests single-use attribution and removal of link URLs from later visits.
sdk/​src/​main/​java/​cloud/​mindbox/​mobile_sdk/​managers/​LifecycleManager.kt Adds atomic source consumption for immediate and pending visits.

Review effort: Balanced

sameActivity: Boolean = true,
): Unit = loggingRunCatching {
val source = if (intentChanged) intentSource(intent) else DIRECT
val source = takeIntentSource(intent)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ожидаемое поведение. Не будем чинить

@enotniy
enotniy merged commit 5c525fb into develop Nov 20, 2026
9 checks passed
@enotniy
enotniy deleted the feature/fix-track-visit-source-for-reinit branch November 20, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants